<div class="row"> <h3 class="page-header">实验室项目管理</h3></div>
<div class="row">
    <div class="panel panel-default">
        <div class="panel-body">
         <label><a class="btn btn-primary addText"  data-id='{$list.id}'>添加</a></label>
            <div class="table-responsive">
                <table class="table table-striped table-bordered table-hover">
                    <thead>
                    <tr>
                        <th width="60">序号</th>
                        <th>项目名称</th>
                        <th>排序</th>
                        <th width="120">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                        <empty name="list">
                            <tr><td colspan="4" align="center">暂无信息</td></tr>
                        </empty>
                        <volist name="list" id="list">
                            <tr>
                                <td>{$i}</td>
                                <td>{$list.name}</td>
                                <td><input class="setSort" type="text" size="5" data-url="{:U('Jxsysz/sysxmglsetSort?id='.$list['id'])}" value="{$list.sort}"></td>
                                 <td>
                                <a class=" btn btn-default btn-sm editText" data-id='{$list.id}'>修改</a>
                                <button data-url='{:U("Jxsysz/sysxmgldel?id=".$list["id"])}' class="btn-sm btn btn-default delBtn" type="button">删除</button>
                                </td>                         
                             </tr>
                         </volist>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<div id="myModal" class="modal fade in" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <form action="{:U('Jxsysz/sysxmgladd')}" id="myform" class="form-horizontal" data-callback="_form_defult_callback">
                <div class="modal-header">
                    <button data-dismiss="modal" class="close" type="button">×</button>
                    <h4 class="modal-title">实验室项目管理</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">项目名称：<span class="c-red">*</span></label>
                        <div class="col-sm-6 input-group">
                            <input class="form-control required" name="name">
                        </div>
                    </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">排序：</label>
                    <div class="col-sm-4 input-group">
                        <input class="form-control digits" name="sort" value="100">
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary" type="submit">保存</button>
                    <button data-dismiss="modal" class=" btn btn-default" type="button">关闭</button>
                </div>
               <input type='hidden' name='id' value='{$info.id}'>
            </form>
        </div>
    </div>
</div>
<script>
    $(function(){
        $('.addText').click(function(){
            $('#myform')[0].reset();
            $('#myModal').modal('show');
        });
        $('.editText').click(function(){
            $('#myform')[0].reset();
            var id = $(this).data('id'); waiting();
            $.get('{:U("Jxsysz/sysxmgledit")}', {id: id}, function(data){
                complete();
                if(data.status == 1){
                    var _get_info = data.info;
                    $('#myform input[name="id"]').val(_get_info.id);
                    $('#myform input[name="name"]').val(_get_info.name);
                    $('#myform input[name="sort"]').val(_get_info.sort); 
                    $('#myform').attr('action', '{:U("Jxsysz/sysxmgledit")}');
                    $('#myModal').modal('show');
                }else{
                    showInfo(data.info);
                    setTimeout('_form_defult_callback()', 1600);

                }
            });
        })
    });

</script>